<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示页面</title>
    <link rel="stylesheet" type="text/css" href="../resource/css/displaypage.css"/>
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<script>
    function get() {
        var ID = document.getElementsByName("studentId");
        for (var i = 0; i < ID.length; i++) {
            console.log(ID[i].innerHTML);
        }
        var endRow = ID[ID.length - 1].innerHTML;
        var startRow = ID[0].innerHTML;
        return {
            endRow, startRow,
        }
    }

    function end() {
        var url = "/displayServlet?endRow=" + get().endRow + "";
        window.location.href = url;
    }
</script>
<body>
<div style="position: center">
    <div id="library">
    <table align="center" border="1">
        <tr>
            <th style="text-align:center;">学生ID</th>
            <th style="text-align:center;">学生姓名</th>
            <th style="text-align:center;">学生入学日期</th>
            <th style="text-align:center;">学生电话</th>
            <th style="text-align:center;">学生所在的学期</th>
            <th style="text-align:center;">学生状态</th>
            <th style="text-align:center;">操作</th>
        </tr>
        <c:forEach items="${StudentByPage}" var="student">
            <tr>
                <td name="studentId">${student.studentId}</td>
                <td>${student.name}</td>
                <td align="center">${student.dateOfEnrollment}</td>
                <td>${student.contactNumber}</td>
                <td align="center">${student.semester}</td>
                <td align="center">${student.studentStatus}</td>
                <td>
                    <a href="/delServlet?studentId=${student.studentId}">删除</a>
                    <a href="/SumServlet?studentId=${student.studentId}">更新</a>
                </td>
            </tr>
        </c:forEach>
    </table>
        <button ><a href="/pages/Login.jsp">Back to Home</a></button>
        <button id="downButton" onclick="end()"><a>Next Page</a></button>
    </div>
</div>
</body>
</html>

